This function generates a template which can be used in fill-template operations where rhythmic variation is required.
(setq temp1 (gen-template 0.11 3 1 16))
--> (= x x x x x x x x x x x = = x x)
(setq rhyx (fill-template temp1 '(a b c d)))
--> (= a b c d a b c d a b c = = d a)
The quantity and distribution of these rest symbols are controlled by ratio-s and ratio-r settings. In the example above the ratio is set to control the random operation to have a distribution of 3 symbols to 1 rest symbol.